package com.wanlian.dao.impl;

import com.wanlian.dao.DeviceConfigDao;
import com.wanlian.entity.DeviceConfig;
import org.springframework.stereotype.Component;

@Component
public class DeviceConfigDaoImpl extends GenericDaoImpl<DeviceConfig> implements DeviceConfigDao {

    public DeviceConfigDaoImpl() {
        super(DeviceConfig.class);
    }

    /**
     * 通过device 的主键Id查询配置
     *
     * @param Id
     * @return
     */
    @Override
    public DeviceConfig queryByDevKey(int Id) {
        String hql = String.format("from %s where deviceId=?", entityClassName());
        DeviceConfig deviceConfig = this.queryForObject(hql, new Object[]{Id});
        return deviceConfig;
    }
}
